First, the syntax definition difference: the static keyword must be added before the static variable, but not before the instance variable.Differences during program running: instance variables belong to the attributes of an object. You must create
Java Basics-Stack and heap, static, final modifier, inner class, and Java memory allocation (RPM)Java Stack and heapHeap: Random in orderStack: LIFO (last-in/first-out).The Java heap is a run-time data area in which the objects of the class allocate
1.static concept Static modifier, what is static modifier? As you know, any variable or code in the program is automatically allocated by the system at compile time to store the memory, and so-called static refers to the memory allocated after
Static {} (static block) is executed only once when the class is loaded. It is generally used to initialize static variables and call static methods, next we will discuss in detail the features and applications of this statement block.1. During a
Static variables, static methods, static classes in JavaStatic variables and static methods are static objects, and it is necessary to explain the differences between them and non-static objects.(1) What is the difference between a Java static
One, static variable
The member variable decorated by the static keyword is called a static variable, and before we talk about the difference between a member variable and a local variable, what is the difference between a static variable and a
static denotes "global" or "static" meaning, used to decorate member variables and member methods, or to form static-code blocks, but the concept of global variables is not available in the Java language. The member variables and member methods that
Static represents the meaning of "global" or "static", which modifies member variables and member methods, and can also form statically static blocks of code, but there is no concept of global variables in the Java language. member variables and
Static
represents the meaning of "global" or "static", which modifies member variables and member methods, and can also form statically static blocks of code, but there is no concept of global variables in the Java language.
There are two types of member variables for the ①java class: A variable that is modified by the static keyword, called a class variable or static variable Another no static modifier, for member variables ② popular Point said:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.